package org.zhouhe.common;

import java.util.Date;

import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;

public class SpringmvcWebBinding implements WebBindingInitializer {

	public void initBinder(WebDataBinder binder, WebRequest request) {
		binder.registerCustomEditor(Date.class, new CustomDateEditor(new EnumDateFormater(), true));
	}
	public static void main(String[] args) throws Exception {
		EnumDateFormater df = new EnumDateFormater();
		System.out.println(df.parse("2011-9-10"));
		System.out.println(df.parse("2011-9-10 10:42:57"));
		System.out.println(df.parse("2011/9/10"));
	}
}


